<extend name="Public:base" />
<block name="content">
	<div class="page-header">
		<h1>
			{$breadcrumb2}
			<small>
				<i class="icon-double-angle-right"></i>
				{$crumbs}
			</small>
		</h1>
	</div>	
	<ul class="nav nav-tabs">
		
	  <li class="active"><a href="#tab-order" data-toggle="tab">订单详情</a></li>
	 
	  <!--<li><a href="#tab-shipping" data-toggle="tab">收货地址</a></li>
	 
	  <li><a href="#tab-product" data-toggle="tab">商品清单</a></li>-->
	  
	  <!--<li><a href="#tab-history" data-toggle="tab">订单历史</a></li>-->
	  
	</ul>
	<div class="tab-content">
		<div id="history"></div>
		<div class="tab-pane active" id="tab-order">
			<table class="table table-bordered">
				<!--<tr>
				    <td>订单ID</td>
				    <td>{$data.order.order_id}</td>
				</tr>-->
				<tr>
					<td>订单编号</td>
					<?php $w_order_id = $data['order']['order_id'];?>
					<td><a class=""  href='{:U("Order/show_order",array("id"=>$w_order_id))}'>{$data.order.order_num}</a></td>
				</tr>
				<tr>
					<td>会员名称</td>
					<td>{$data.order.user_name}</td>
				</tr>
				<!--<tr>
				    <td>电子邮件</td>
				    <td>{$data.order.email}</td>
				</tr>
				  <tr>
				    <td>联系电话</td>
				    <td>{$data.order.telephone}</td>
				</tr> -->
				<tr>
				    <td>合计金额</td>
				    <td>
				    	￥{$data.order.price}
				    </td>
				</tr>
				<tr>
					<td>申请日期</td>
					<td>{$data.order.create_time|toDate='Y/m/d H:i:s'}</td>
				</tr>
				<tr>
					<td>商品名称</td>
					<td>{$data.order_product.name}</td>
				</tr>
				<tr>
				    <td>订单状态</td>
				    <td id="order-status">{$data.order.order_status_text}</td>
				</tr>
				<tr>
					<td>退换货描述</td>
					<td>{$data.order.tuihuo_case}</td>
				</tr>
				<tr>
					<td>用户上传图片</td>
					<td>
						<volist name="data.order.voucher" id="v">
							<a href="Uploads/image/{$v}" target="_blank">
								<img src="Uploads/image/{$v}" width="100" height="100">
							</a>
						</volist>
					</td>
					<!--<td id="order-status">{$data.order.tuihuo_case}</td>-->
				</tr>
				<tr>
					<td>操作状态</td>
					<td>
						<select name="order_status_id">
							<!--<option value="">-选择状态-</option>-->
							<option value="7" <if condition="$data['order']['status'] eq 7">selected</if>>审核中</option>
							<option value="8" <if condition="$data['order']['status'] eq 8">selected</if>>审核失败</option>
							<option value="9" <if condition="$data['order']['status'] eq 9">selected</if>>审核通过</option>
							<!--<option value="10">退货中</option>
							<option value="11">退款中</option>
							<option value="12">完成</option>
							<option value="13">已撤销</option>-->
						</select>
					</td>
				</tr>
				<!--<tr>
					<td>IP地址</td>
					<td>{$data.order.ip_region}</td>
				</tr>  
				<tr>
					<td>用户系统</td>
					<td>{$data.order.user_agent}</td>
				</tr>-->
				<!--<tr>
					<td>下单时间</td>
					<td>{$data.order.date_added|toDate='Y/m/d H:i:s'}</td>
				</tr>
				<tr>
					<td>修改时间</td>
					<td>{$data.order.date_modified|toDate='Y/m/d H:i:s'}</td>
				</tr>-->
				</table>
			<div class="text-right">
				<button id="button-history" class="btn btn-primary" data-loading-text="Loading...">
					<i class="fa fa-plus-circle"></i>
					保存
				</button>
			</div>

		</div>


		
	</div>
</block>
<block name="javascript">
<script>	
$('#history').load('<?php echo U("ReturnOrder/history",array("id"=>I("id"))); ?>');
$('#button-history').live('click', function() {

	$.ajax({
		url: '<?php echo U("ReturnOrder/history",array("id"=>I("id"))); ?>',
		type: 'post',
		dataType: 'html',
		data: 'order_status_id=' + encodeURIComponent($('select[name=\'order_status_id\']').val()) + '&notify=' + encodeURIComponent($('input[name=\'notify\']').attr('checked') ? 1 : 0)  + '&comment=' + encodeURIComponent($('textarea[name=\'comment\']').val()),
		beforeSend: function() {
			$('.success, .warning').remove();
			$('#button-history').attr('disabled', true);
			$('#history').prepend('<div class="attention"><img src="__IMG__/loading.gif" alt="" />加载中...</div>');
		},
		complete: function() {
			$('#button-history').attr('disabled', false);
			$('.attention').remove();
		},
		success: function(html) {
			$('#history').html(html);
			
			$('textarea[name=\'comment\']').val('');
			
			$('#order-status').html($('select[name=\'order_status_id\'] option:selected').text());
		}
	});
});
</script>
</block>